﻿DECLARE @rowCount INT
EXEC  bd_proc_report_overtime_detail '2020-06-01'
                                    ,'2020-06-30'
                                    ,''
--                                    ,@users = '20001255,20001761,20002113,20002356,20002633'
                                    ,''
--                                    ,@depts = ''
                                    ,'202988,203073'
                                    ,''
                                    ,''
                                    ,''
                                    ,1
                                    ,10
                                    ,100
                                    ,@rowCount OUTPUT
SELECT @rowCount

EXEC bd_proc_report_overtime_detail '2020-06-01', '2020-06-30', 'L0040'

EXEC bd_proc_report_leave_detail '2020-06-01', '2020-06-30', 'CHL2431'

EXEC bd_proc_report_employee_swipe '2020-07-01', '2020-07-30', '', '20001255,20001761', '', '', '', '', 1, 5, 3

EXEC bd_proc_report_dayoff   @year =2020,
  @month  =6,
  @userNameOrNo = '',  --工号或姓名
  @users  = '20001255,20001761',
  @depts  = '',
  @userType  = '',
  @userCompany = '',
  @userStatus  = ''

EXEC bd_proc_report_overtime    @dateBegin ='2020-06-01',
  @dateEnd  ='2020-06-30',
  @userNameOrNo = '',  --工号或姓名
  @users =  '20001255,20001761',
  @depts = '',
  @userType =  '',
  @userCompany = '',
  @userStatus  = '' 


DECLARE @rowCount INT
EXEC  bd_proc_report_leave_detail '2020-06-01'
                                    ,'2020-06-30'
                                    ,''
--                                    ,@users = '20001255,20001761,20002113,20002356,20002633'
                                    ,'20002633,20002113'
--                                    ,@depts = ''
                                    ,''
                                    ,''
                                    ,''
                                    ,''
                                    ,1
                                    ,10
                                    ,1
                                    ,@rowCount OUTPUT
SELECT @rowCount

--20001255	L0040	吴晓钢	    3.0	3.0	7.0
--20001761	L2138	李冬梅	    3.5	5.0	6.0
--20002113	CHL0393	冯菊	  1.0	4.5	9.0
--20002356	CHL1462	陈敬	  1.0	6.5	13.0
--20002633	CHL2431	周登群	  1.0	6.5	12.0

SELECT * FROM lr_kqingj 
  WHERE user_serial=20002633

  SELECT * FROM bd_view_leave 
  WHERE user_serial=20002633


 
    INSERT INTO #result (user_serial, user_no, user_name, dept_id, dept_name, card_no, card_manhour, company, user_type, user_status, 
      bill_no, applicant_no, applicant_name, date_begin, time_begin, date_end, time_end, create_time)
    SELECT leave.user_serial, u.user_no, u.user_lname, u.user_dep, u.user_depname, u.card_number, u.man_hour_system, u.user_company, u.user_sny_lx, u.user_sny_type,
      leave.order_no, cu.user_no, cu.user_lname, leave.start_date, leave.begin_time, leave.end_date, leave.end_time, leave.create_time
    FROM bd_view_leave leave
    INNER JOIN bd_view_user_all u ON u.user_serial = leave.user_serial
    INNER JOIN (SELECT user_serial, user_no, user_lname FROM bd_view_user_all) cu ON cu.user_serial = leave.creater_id
    WHERE 1 = 1  AND u.user_dep IN(20002633)